package hxy.dragon.spring.webflux.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.ArrayList;
import java.util.List;

@RestController
public class BasicController {
    @GetMapping("/")
    public Mono<String> index() {
        return Mono.just("SpringWevFlux响应式编程");
    }

    @GetMapping("/hello_world")
    public Mono<String> sayHelloWorld() {
        return Mono.just("Hello World");
    }

    @GetMapping("/reactor")
    public Flux<String> reactor() {
        List<String> list =new ArrayList<>();
        list.add("SpringWevFlux");
        list.add("Reactor");
        return Flux.fromIterable(list);
    }
}